<template>
  <div ref="mdviewer"></div>
</template>
<script>
  // import Viewer from '@toast-ui/editor';
  import Viewer from '@toast-ui/editor/dist/toastui-editor-viewer'
  import { optionsMixin } from './option';

  export default {
    name: 'Mdviewer',
    mixins: [optionsMixin],
    props: {
      height: {
        type: String
      },
      initialValue: {
        type: String
      },
      options: {
        type: Object
      }
    },
    mounted() {
      const options = { ...this.computedOptions, el: this.$refs.mdviewer };
      this.editor = new Viewer(options);
    },
    methods: {
      getRootElement() {
        return this.$refs.mdviewer;
      },
      setMarkDown: function (val) {
        this.editor.setMarkdown(val)
      }
    }
  };
</script>
